<%@ page contentType="text/html;charset=UTF-8"%>
<!-- 引入标签库 -->
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib tagdir="/WEB-INF/tags/simpletable" prefix="simpletable"%>
    
<html>
<head>
	<title>订单维护</title>
	<!-- 包含公共资源 -->
	<%@ include file="/commons/meta.jsp" %>
	<%@ include file="/commons/meta-easyui.jsp" %>
	<%@ include file="/commons/meta-simpletable.jsp" %>
	<script type="text/javascript">
		function toAdd(){
			$("#queryForm").attr('action',"${ctx}/Orders/create.do");
			$("#queryForm").submit();
		}
	</script>
</head>
<body>
<%@include file="/commons/messages.jsp" %>
	<form id="queryForm" name="queryForm" method="post" action="${ctx}/Orders/list.do" style="display: inline;">
	<!-- 搜索区域 -->
	<div class="queryPanel">
		<fieldset>
			<legend>搜索</legend>
			<table>
				<tr>	
					<td class="tdLabel">用户</td>		
					<td>
						<input value="${query.userId}" id="userId" name="userId"  />
					</td>
					<td class="tdLabel">发生日期</td>		
					<td>
						<input value="<fmt:formatDate value='${query.edateBegin}' pattern='<%=Orders.FORMAT_EDATE%>'/>" class="easyui-datebox" name="edateBegin"   />
						<input value="<fmt:formatDate value='${query.edateEnd}' pattern='<%=Orders.FORMAT_EDATE%>'/>"   class="easyui-datebox" name="edateEnd"   />
					</td>
					<td class="tdLabel">地址</td>		
					<td>
						<input value="${query.address}" id="address" name="address"  />
					</td>
					<td class="tdLabel">联系人</td>		
					<td>
						<input value="${query.contactman}" id="contactman" name="contactman"  />
					</td>
				</tr>	
				<tr>	
					<td class="tdLabel">联系电话</td>		
					<td>
						<input value="${query.phonenumber}" id="phonenumber" name="phonenumber"  />
					</td>
					<td class="tdLabel">邮编</td>		
					<td>
						<input value="${query.postcode}" id="postcode" name="postcode"  />
					</td>
					<td class="tdLabel">总价</td>		
					<td>
						<input value="${query.total}" id="total" name="total"  />
					</td>
					<td class="tdLabel">处理日期</td>		
					<td>
						<input value="<fmt:formatDate value='${query.dealdateBegin}' pattern='<%=Orders.FORMAT_DEALDATE%>'/>" class="easyui-datebox" name="dealdateBegin"   />
						<input value="<fmt:formatDate value='${query.dealdateEnd}' pattern='<%=Orders.FORMAT_DEALDATE%>'/>"   class="easyui-datebox" name="dealdateEnd"   />
					</td>
				</tr>	
				<tr>	
					<td class="tdLabel">状态</td>		
					<td>
						<input value="${query.status}" id="status" name="status"  />
					</td>
					<td class="tdLabel">备注</td>		
					<td>
						<input value="${query.note}" id="note" name="note"  />
					</td>
				</tr>	
				<tr>
					<td> 
					<a href="javascript:;" class="easyui-linkbutton"
						iconCls="icon-search" 
						onclick="getReferenceForm(this).submit();">搜索</a>
					</td>
				</tr>			
			</table>
		</fieldset>
		<!-- 新增和删除按钮 -->		
		<div class="handleControl" style="margin: 10px 0;">
				<a href="javascript:;" onclick="toAdd();" class="easyui-linkbutton" iconCls="icon-add">新增</a>
				<a href="javascript:;" 
				onclick="batchDelete('${ctx}/Orders/delete.do','items','queryForm');" 
				class="easyui-linkbutton" iconCls="icon-remove" >删除</a>
		<div>
	
	</div>
	<!-- 搜索区域  结束-->
	<!-- 数据区域 -->
	<div class="gridTable">
		<table width="100%"  border="0" cellspacing="0" class="gridBody">
		  <thead>
			  
			  <tr>
				<th style="width:1px;"> </th>
				<th style="width:1px;"><input type="checkbox" onclick="setAllCheckboxState('items',this.checked)"></th>
				
				<th sortColumn="USER_ID" >用户</th>
				<th sortColumn="EDATE" >发生日期</th>
				<th sortColumn="ADDRESS" >地址</th>
				<th sortColumn="CONTACTMAN" >联系人</th>
				<th sortColumn="PHONENUMBER" >联系电话</th>
				<th sortColumn="POSTCODE" >邮编</th>
				<th sortColumn="TOTAL" >总价</th>
				<th sortColumn="DEALDATE" >处理日期</th>
				<th sortColumn="STATUS" >状态</th>
				<th sortColumn="NOTE" >备注</th>
	
				<th>操作</th>
			  </tr>
			  
		  </thead>
		  <tbody>
		  	  <c:forEach items="${page.result}" var="orders" varStatus="status">
		  	  
			  <tr class="${status.count % 2 == 0 ? 'odd' : 'even'}">
			  	<!-- 序号 -->
				<td>${page.thisPageFirstElementNumber + status.index}</td>
				<!-- 复选框 -->
				<td><input type="checkbox" name="items" value="${orders.id}"></td>
				<!-- 从第三列开始 是真正的数据 用el表达式取每个对象的每个属性 -->
				<td><c:out value='${orders.userId}'/>&nbsp;</td>
				<td><c:out value='${orders.edate}'/>&nbsp;</td>
				<td><c:out value='${orders.address}'/>&nbsp;</td>
				<td><c:out value='${orders.contactman}'/>&nbsp;</td>
				<td><c:out value='${orders.phonenumber}'/>&nbsp;</td>
				<td><c:out value='${orders.postcode}'/>&nbsp;</td>
				<td><c:out value='${orders.total}'/>&nbsp;</td>
				<td><c:out value='${orders.dealdate}'/>&nbsp;</td>
				<td><c:out value='${orders.status}'/>&nbsp;</td>
				<td><c:out value='${orders.note}'/>&nbsp;</td>
				<td>
					<a href="${ctx}/Orders/show.do?id=${orders.id}">查看</a>&nbsp;&nbsp;
					<a href="${ctx}/Orders/edit.do?id=${orders.id}">修改</a>&nbsp;&nbsp;
				</td>
			  </tr>
			  
		  	  </c:forEach>
		  </tbody>
		</table>
		<p style="margin: 10px 0;">
		<!-- 分页区域 -->
		<simpletable:pageToolbar page="${page}"></simpletable:pageToolbar>
		<!-- 分页区域 结束 -->
	</div>
	<!-- 数据区域  结束-->
	</form>
</body>
</html>

